import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/prePurchaseRequest',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/prePurchaseRequest/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/prePurchaseRequest',
    method: 'put',
    data
  })
}

export function pass(ids, b2b) {
  let params = {
    'ids': ids,
    'b2b': b2b
  }

  return request({
    url: 'api/prePurchaseRequest/pass',
    method: 'post',
    data: params
  })
}

export function cancel(id) {
  return request({
    url: 'api/prePurchaseRequest/cancel/' + id,
    method: 'post'
  })
}

export default { add, edit, del, pass, cancel }
